Skip to content
This repository was archived by the owner on Jun 25, 2026. It is now read-only.

Add support for routable engines#97

Closed
aaxelb wants to merge 2 commits into
intercom:masterfrom
aaxelb:engine-support
Closed

Add support for routable engines#97
aaxelb wants to merge 2 commits into
intercom:masterfrom
aaxelb:engine-support

Conversation

@aaxelb

@aaxelb aaxelb commented May 18, 2018

Copy link
Copy Markdown

Make {{href-to}} act like {{link-to}} does within an engine, automatically prefixing routes with the engine's namespace.

Add {{href-to-external}} helper, for linking to routes in an engine's host app. Acts like {{link-to-external}}.

This is a breaking change for anyone using {{href-to}} within an engine to link to routes in the host app, but that seems like an uncommon case.

I was not sure how to write tests that pretend to be in an engine, suggestions are welcome.

Comment thread addon/helpers/href-to.js Outdated
let owner = getOwner(context);

// If used in an engine, namespace the route
if(owner.mountPoint && targetRouteName !== 'application') {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps create a well named variable in place of the comment? Something like linksToEngine or linksToOtherEngine perhaps?

@GavinJoyce

Copy link
Copy Markdown
Member

I was not sure how to write tests that pretend to be in an engine, suggestions are welcome.

I'm not familiar with engines so I don't have any good suggestions. Perhaps there are some tests in https://github.com/ember-engines/ember-engines that will serve as a guide?

@GavinJoyce GavinJoyce closed this May 20, 2018
@GavinJoyce GavinJoyce reopened this May 20, 2018
@willviles

Copy link
Copy Markdown

@aaxelb - You need to add export { default } from 'ember-href-to/helpers/href-to-external' to app/helpers/href-to-external.js.

Apart from that, this seems to work!

@jamescdavis

Copy link
Copy Markdown

Bump.

@GCheung55

Copy link
Copy Markdown
Contributor

@GavinJoyce @jamescdavis any updates on this?

@jamescdavis

Copy link
Copy Markdown

Needs rebased to resolve conflicts. @aaxelb?

@aaxelb

aaxelb commented Jul 16, 2020

Copy link
Copy Markdown
Author

rebas'd to resolve conflicts!

tho now the build is failing for node version reasons:

error ember-cli-version-checker@4.1.1: The engine "node" is incompatible with this module. Expected version "8.* || 10.* || >= 12.*". Got "6.17.1"

@GCheung55

GCheung55 commented Jul 20, 2020

Copy link
Copy Markdown
Contributor

I've created PR #128 to just bump the Node.js version to 8 in .travis.yaml.

@GCheung55

Copy link
Copy Markdown
Contributor

@aaxelb can you rebase? #128 was merged and should fix the Node.js version issue.

@aaxelb aaxelb force-pushed the engine-support branch 2 times, most recently from 2797dfd to b761532 Compare July 21, 2020 20:23
aaxelb added 2 commits July 21, 2020 16:25
Make {{href-to}} behave the same as {{link-to}} within an engine,
automatically prefixing routes with the engine's namespace

Add {{href-to-external}}, for routes external to the engine.
@villander

Copy link
Copy Markdown

Any chance to merge this?

@villander

Copy link
Copy Markdown

Any update on this?

@patocallaghan

Copy link
Copy Markdown
Member

The ember-href-to package is now maintained by the Ember community and lives at https://github.com/adopted-ember-addons/ember-href-to. We're closing this PR and archiving this repo. If you still think it's relevant, please reopen it against the new repo.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants